
import java.util.ArrayList;

public class OrderList
{
	// Storage for an arbitrary number of details.
	private ArrayList <Order> orderList;

	public ArrayList<Order> getOrderList() {
		return orderList;
	}

	/**
	 * Perform any initialization .
	 */
	public OrderList()
	{
		orderList = new ArrayList<Order>() ;
	}

	/**
	 * Add a new set of details to the list
	 * @param details The details of the staff
	 */
	public void addDetails(Order details) 
	{
		orderList.add(details);
	}

	public boolean hasOrder() {
		return orderList.size() != 0;
	}

	public Order getNextOrder() {
		Order order =  orderList.remove(0);
		return order;

	}

	/**
	 * @return All the details
	 */
	public String listDetails()
	{
		StringBuffer allEntries = new StringBuffer();
		for (Order details : orderList) {
			allEntries.append(details.getOrderID() );
			allEntries.append('\n');
		}
		return allEntries.toString();
	}

	public boolean checkEquality(Order o){
		for(Order order: orderList){
			if (o.equals(order)){
				System.out.println("Order id: "+o.getOrderID()+" allready exists.");
				return true;
			}
		}
		return false;
	}



}
